import java.util.Scanner;

// 1:无需package
// 2: 类名必须Main, 不可修改
//题目地址：https://www.lanqiao.cn/problems/3510/learning/
public class 冶炼金属 {
    private static int[] A;//原材料数
    private static int[] B;//成品数
    private static int Lmin = 1;
    private static int Rmin = 1000000000;
    private static int N;

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        N = scan.nextInt();
        A = new int[N];
        B = new int[N];
        //输入数据
        for (int i = 0; i < N; i++) {
            A[i]=scan.nextInt();
            B[i]=scan.nextInt();
        }

        //先计算left值
        while(Lmin<Rmin){
            int mid=Lmin+Rmin>>1;
            if(checkLmin(mid)){
                //目标值在左边，移动右指针
                Rmin=mid;
            }
            //目标值在右边
            else Lmin=mid+1;
        }
        int min=Lmin;
        //然后找右边界
        Rmin=1000000000;
        Lmin=1;
        while(Lmin<Rmin){
            int mid=Lmin+Rmin+1>>1;
            if(checkRmin(mid)){
                //目标值在右边
               Lmin=mid;
            }
            //目标值在左边
            else  Rmin=mid-1;
        }
        System.out.println(min+" "+Rmin);
        scan.close();
    }

    private static boolean checkLmin(int mid) {
        for (int i = 0; i < N; i++) {
            //目标值在右边
            if (B[i] < A[i] / mid) {
                return false;
            }
        }
        return true;
    }

    private static boolean checkRmin(int mid) {
        for (int i = 0; i < N; i++) {
            if (B[i] > A[i] / mid) {
                return false;
            }
        }
        return true;
    }
}